<?php
require '../conn.php';
require 'config.php';
require '../inc/function.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../css/admin.css" type="text/css" />
<script type="text/javascript" src="inc/function.js"></script>
<script type="text/javascript" src="../fy_ckeditor/ckeditor.js"></script>
</head>
<body>
<?php
if ($act=='modify'){
	$j_class=ReStra($_POST['j_class']);
	$j_index=ReStra($_POST['j_index']);
	$j_order=ReStra($_POST['j_order']);
	$j_name=ReStra(trim($_POST['j_name']));
	$j_image=ReStra($_POST['j_image']);
	$j_content=ReStra($_POST['j_content']);
	$k_name=ReStra($_POST['k_name']);
	$k_keyword=ReStra($_POST['k_keyword']);
	$k_description=ReStra($_POST['k_description']);
	$imagj_original=RsField_Array('select j_image from '.$language.'_journal where j_id='.$id);
	if ($j_image!=$imagj_original[0]) DeleteFile('../'.$imagj_original[0]);
	$sql="update ".$language."_journal set 
	j_class=$j_class,
	j_index=$j_index,
	j_order=$j_order,
	j_name='$j_name',
	j_image='$j_image',
	j_content='$j_content',
	k_name='$k_name',
	k_keyword='$k_keyword',
	k_description='$k_description'
	 where j_id=$id";
	mysql_query($sql) or die(mysql_error($sql));
	Msg('','journal.php?'.$urls);
}

$query=mysql_query('select * from '.$language.'_journal where j_id='.$id,$conn);
$row=mysql_fetch_array($query);
?>
<div id="container">
  <div class="edit">
      <h1>外贸杂志<a href="javascript:location.reload();">刷新</a></h1>
      <form name="form1" method="post" action="?act=modify&<?php echo $urls.'&id='.$id ?>" onsubmit="return CheckJournal(this);">
        <table id="protbe" width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td class="edit_title">杂志分类：</td>
            <td><select name="j_class" class="input_select"><?php
			$str='';
			$query2=mysql_query('select * from '.$language.'_journal_class order by j_order,j_id');
			if(mysql_num_rows($query2)>0){
			while($row2=mysql_fetch_array($query2)){
				$str.='<option value="'.$row2['j_id'].'">'.$row2['j_name'].'</option>';
			}
			}
			echo $str;
			?></select></td>
          </tr>
          <tr>
            <td class="edit_title">首页显示：</td>
            <td><select name="j_index" class="input_select"><option value="0">否</option><option value="1">是</option></select></td>
          </tr>
          <tr>
            <td class="edit_title">杂志名称：</td>
            <td><input type="text" name="j_name" class="inputtext" value="<?php echo $row['j_name'] ?>" size="80" maxlength="200" /></td>
          </tr>
          <tr>
            <td class="edit_title">杂志图片：</td>
            <td><input type="text" name="j_image" id="j_image" class="inputtext" value="<?php echo $row['j_image'] ?>" size="50" readonly="readonly" />&nbsp;(图片尺寸：200*260)<iframe src="../upload_fy.php?file_type=0&file_id=j_image" frameborder="0" allowtransparency="true" scrolling="no" width="100%" height="25"></iframe></td>
          </tr>
          <tr>
            <td class="edit_title">杂志排序：</td>
            <td><input type="text" name="j_order" id="j_order" class="inputtext" value="<?php echo $row['j_order'] ?>" size="10" maxlength="10" /></td>
          </tr>
          <tr>
            <td class="edit_title">Title：</td>
            <td><input type="text" name="k_name" class="inputtext" value="<?php echo $row['k_name'] ?>" style="width:98%" maxlength="255" /></td>
          </tr>
          <tr>
            <td class="edit_title">Keyword：</td>
            <td><input type="text" name="k_keyword" class="inputtext" value="<?php echo $row['k_keyword'] ?>" style="width:98%" maxlength="255" /></td>
          </tr>
          <tr>
            <td class="edit_title">Description：</td>
            <td><input type="text" name="k_description" class="inputtext" value="<?php echo $row['k_description'] ?>" style="width:98%" maxlength="255" /></td>
          </tr>
          <tr>
            <td class="edit_title">详细介绍：</td>
            <td><div class="edit_contents"><textarea name="j_content" class="ckeditor"><?php echo $row['j_content'] ?></textarea></div></td>
		  </tr>
          <tr>
            <td class="edit_title" height="30">&nbsp;</td>
			<td><input type="submit" name="button" class="button" value=" 保存 " />&nbsp;&nbsp;<input type="button" name="button" class="button" value=" 返回 " onclick="location.href='journal.php?<?php echo $urls ?>'" /></td>
          </tr>
        </table>
    </form>
	<script type="text/javascript">
	document.form1.j_class.value="<?php echo $row['j_class'] ?>";
	document.form1.j_index.value="<?php echo $row['j_index'] ?>";
	</script>
    </div>
</div>
</body>
</html>